package com.example.administrator.kaohedemo.Action;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2016/6/20.
 */
public class Action {

    private String type;
    private Map<String,Object> data;

    public Action(String type,Map<String,Object> data){
        this.type=type;
        this.data=data;
    }

    public static Builder setType(String type){
        return new Builder().set(type);
    }

    public String getType(){
        return type;
    }

    public Map<String,Object> getMap(){
        return data;
    }

    public static class Builder{

        private String type;
        private Map<String,Object> data;

        public Builder set(String type){
            this.type=type;
            data=new HashMap<String,Object>();
            return this;
        }

        public void put(String key,Object value){
            data.put(key,value);
        }

        public Action build(){
            return new Action(type,data);
        }

    }

}
